Find the closest date when an attribute was true

Find the closest date when an attribute was true

To find the closest date when an attribute was true you use the When Last and When Next functions. These functions look forwards or backwards from a reference date and return a date when a specified boolean attribute is true.

Find the date on which a boolean attribute was last true

To return the date on which a boolean attribute was last true, looking backwards from a reference date (including the reference date), you use the When Last function. This function has the following syntax:

 

For example, to determine when a customer's bank balance was last over $100, you would write the following rule in Word:

the date the customer's bank balance was last over $100 = WhenLast(the current date,the customer's bank balance > 100)

Find the date on which a boolean attribute will next be true

To return the date on which a boolean attribute will next be true, looking forwards from a reference date (including the reference date), you use the When Next function. This function has the following syntax:

 

For example, to determine when was the first time in 2007 that a customer's bank balance was over $100, you would write the following rule in Word:

the date the customer's bank balance was over $100 for the first time in 2007= WhenNext(2007-01-01,the customer's bank balance > 100)

 

TIP: To see an example of a complete rulebase using this function, open and run the Aged Care Approval rulebase project provided in the Examples folder in the Oracle Policy Modeling installation folder.